// 此处第二个参数vm，就是我们在页面使用的this，你可以通过vm获取vuex等操作
const install = (Vue, vm) => {

	// 参数配置对象
	const config = vm.vuex_config;

	// 将各个定义的接口名称，统一放进对象挂载到vm.$u.api(因为vm就是this，也即this.$u.api)下
	vm.$u.api = {

		// 登陆注册、个人信息
		login: (params = {}) => vm.$u.post(config.adminPath + '/user/login', params),
		registerUser: (params = {}) => vm.$u.post(config.adminPath + '/user/register', params),
		getUserInfo: (params = {}) => vm.$u.get(config.adminPath + '/user/currentUser', params),
		user: {
			changePwd: (params = {}) => vm.$u.put(config.adminPath + '/user/updatePassword/' +
				params.oldPassword + '/' + params.newPassword),
			changeInfo: (params = {}) => vm.$u.put(config.adminPath + '/user/updateUserMessage', params),
			findFriend: (params = {}) => vm.$u.get(config.adminPath + '/user/myFriends'),
			findFocus: (params = {}) => vm.$u.get(config.adminPath + '/user/findAllFocusApp'),
			findFans: (params = {}) => vm.$u.get(config.adminPath + '/user/findAllFansApp'),
		},
		map: {
			findTeachers: (params = {}) => vm.$u.get(config.adminPath + '/user/findMapTeachers/' +
				params.lg + '/' + params.ln),
			findVenues: (params = {}) => vm.$u.get(config.adminPath + '/user/findMapVenue/' +
				params.lg + '/' + params.ln),
		},
		message: {
			getmessage: (params = {}) => vm.$u.get(config.adminPath + '/user/getAllMessage'),
			agreeFocus: (params = {}) => vm.$u.post(config.adminPath + '/user/follow/' + params.id),
			findMoments: (params = {}) => vm.$u.get(config.adminPath + '/user/findMoments'),
		},
		order: {
			findAll: (params = {}) => vm.$u.get(config.adminPath + '/order/findAllOrder'),
		}
	};

}

export default {
	install
}
